package cn.sciento.farm.devicemanager.gateway.uplink.service.sensor;

import cn.sciento.farm.devicemanager.dao.entity.DevDevice;
import cn.sciento.farm.devicemanager.gateway.model.uplink.CollectionData;
import cn.sciento.farm.devicemanager.gateway.model.uplink.ControlData;
import cn.sciento.farm.devicemanager.gateway.model.uplink.DeviceStatus;
import cn.sciento.farm.devicemanager.gateway.model.uplink.DeviceSystemPacket;
import cn.sciento.farm.devicemanager.gateway.uplink.service.MessageDisposeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


/**
 * @author wumu
 */
@Service
public class MessageAllDisposeService extends AbstractMessageDisposeService {

    @Autowired
    private List<MessageDisposeService> messageDisposeServiceList;


    @Override
    public void changeOnline(DeviceStatus deviceStatus) {
        for (MessageDisposeService messageDisposeService :
                messageDisposeServiceList) {
            messageDisposeService.changeOnline( deviceStatus);
        }
    }

    @Override
    public void changeSwitchStatus(String concentrator, String node, int up) {
        for (MessageDisposeService messageDisposeService :
                messageDisposeServiceList) {
            messageDisposeService.changeSwitchStatus(concentrator, node, up);
        }
    }

    @Override
    public void changeCollectionStatus(String concentrator, String node, int up) {
        for (MessageDisposeService messageDisposeService :
                messageDisposeServiceList) {
            messageDisposeService.changeCollectionStatus(concentrator, node, up);
        }
    }

    @Override
    public void changeDeviceData(CollectionData deviceData) {
        for (MessageDisposeService messageDisposeService :
                messageDisposeServiceList) {
            messageDisposeService.changeDeviceData(deviceData);
        }
    }

    @Override
    public void changeSwitch(ControlData switchStatus) {
        for (MessageDisposeService messageDisposeService :
                messageDisposeServiceList) {
            messageDisposeService.changeSwitch(switchStatus);
        }
    }

    @Override
    public void changeSystem(DeviceSystemPacket systemPacket) {
        for (MessageDisposeService messageDisposeService :
                messageDisposeServiceList) {
            messageDisposeService.changeSystem(systemPacket);
        }
    }

}
